package thread;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;

public class ThreadDemo3 {
    public static void main(String[] args) throws InterruptedException {
        //BlockingQueue<>为阻塞队列的原型
        BlockingQueue<Integer> blockingQueue = new LinkedBlockingDeque<>();
        //take（取元素）、put（插入元素）为阻塞队列的两个核心方法
        blockingQueue.put(20);//插入元素20
        Integer result = blockingQueue.take();//从队头取元素
        System.out.println(result);
    }
}
